package com.java.utils;

/**
 * Created by lu.xu on 2017/6/21. TODO:id生成器(非分布式)
 */
public class IdGeneratorUtils {

    private static long iCount = 100000L;

    /**
     * 获取序列号
     */
    public static synchronized Long getSerialNo() {
        if (iCount > 999998L) {
            iCount = 100000L;
        }
        Long sTime = System.currentTimeMillis();
        return Long.valueOf(sTime + iCount++);
    }

    public static void main(String[] args) {
        System.out.println(getSerialNo());
    }

}